package encapsulation;

public class Student {

    private double score;
    //不需要被外界访问就用private
    //公开的方法  可以被访问
     public  void setScore(double score){
         if (score >= 0&& score <= 100){
             this.score = score;
         }else {
             System.out.println("数据非法~");
         }
     }

     public double getScore(){
         return score;
    }

    public void printPass(){
        System.out.println(score>=60?"成绩及格":"成绩不及格");
    }

}
